package com.example.a10928.weifriend.view;

import android.app.Activity;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.a10928.weifriend.R;


public class BottomButtonLayout extends RelativeLayout {

    TextView tv_title;
    ImageView iv;

    public BottomButtonLayout(Context context) {
        super(context);
    }

    public BottomButtonLayout(Context context, AttributeSet attrs) {
        super(context, attrs);

        LayoutInflater.from(context).inflate(R.layout.layout_bottom_button, this);
        iv = (ImageView) findViewById(R.id.iv);
        tv_title = (TextView) findViewById(R.id.tv);


        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.BottomButtonLayout);
        int drawable = typedArray.getResourceId(R.styleable.BottomButtonLayout_BottomButtonLayout_iv,R.drawable.home_page);
        String title = typedArray.getString(R.styleable.BottomButtonLayout_BottomButtonLayout_tv);
        if(title==null){
            title="";
        }

        typedArray.recycle();//释放资源

        iv.setBackgroundResource(drawable);
        tv_title.setText(title);



    }

    public void setIv(int res){
        iv.setBackgroundResource(res);
    }

}